package store.pay;

import java.math.BigDecimal;
import java.util.Map;

import org.timeismoney.payment.service.PaymentRecordService;

import store.util.PayConfig;

public class PayResultLogicServiceInvoker {
	private PaymentRecordService service;

	public void setService(PaymentRecordService service) {
		this.service = service;
	}

	public void doSuccess(Map map) {
		// 调用 PayResultLogicService 实现
		String orderid = (String)map.get(PayConfig.PAY_RESULT_DO_PARAM_ORDERID);
		Float amount = (Float)map.get(PayConfig.PAY_RESULT_DO_PARAM_ORDERAMOUNT);
		String content = (String)map.get(PayConfig.PAY_RESULT_DO_PARAM_CONTENT);
		System.out.println("订单号："+orderid);
		System.out.println("订单金额："+amount);
		System.out.println("订单信息："+content);
		service.finish(orderid, BigDecimal.valueOf(amount));
		
	}
	
	public void doFail(Map map) {
		// 调用 PayResultLogicService 实现
		System.out.println("============= Fail LOGIC============");
	}
}
